package demo.service.impl;

import demo.dao.CommMapper;
import demo.pojo.Brand;
import demo.pojo.Comm;
import demo.pojo.Page;
import demo.service.CommService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName 刘星宇
 * @Description TODO
 * @date 2023/4/2 18:10
 * @Version 1.0
 */
@Service
public class CommServiceImpl implements CommService {
    @Resource
    private CommMapper commMapper;

    @Override
    public int getCount(Comm comm) {
        return commMapper.getCount(comm);
    }

    @Override
    public List<Comm> getAllByPage(Page<Comm> p, Comm comm) {
        return commMapper.getAllByPage(p,comm);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addComm(Comm comm) {
        commMapper.CommAdd(comm);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateComm(Comm comm) {
        commMapper.CommUpdate(comm);
    }

    @Override
    public void delComm(int cid) {
        commMapper.CommDel(cid);
    }

    @Override
    public Brand findByIds(Integer bid) {
        return commMapper.selectByBid(bid);
    }
}
